#include "plane.h"
#include "Types.h"

plane::plane(void)
	: normal(0.0f, 1.0f, 0.0f), distance(0.0f)
{
	planePoint = normal * distance;
}
plane::plane(float a, float b, float c, float d)
	:normal(vector3(a,b,c)), distance(d)
{
	planePoint = normal * distance;
}
plane::~plane(void)
{
}
plane plane::Normalize() const
{
	float mag = normal.Length();
	return plane(normal.x / mag, normal.y / mag,
		normal.z / mag, distance / mag);
}
int plane::ClassifyPoint(const vector3 &point) const
{
	float fEqu = normal.Dot(point) + distance;
	if(fEqu == 0.0f)
	{
		return POINT_PLANE;
	}
	return POINT_NEGATIVE;
}
